home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / driverkit / i386 / displayRegisters.h < prev    next >
Text File  |  1993-08-06  |  1KB  |  46 lines

  1. /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * displayRegisters.h - i386-specific register helpers
  4.  *
  5.  *
  6.  * HISTORY
  7.  * 03 Aug 93    Scott Forstall
  8.  *      Created. 
  9.  */
  10.  
  11. #import <driverkit/i386/ioPorts.h>
  12.  
  13. static inline unsigned char IOReadRegister(
  14.     IOEISAPortAddress port,
  15.     unsigned char index)
  16. // Description:    Read register at port and index.  Return the
  17. //        current value of the register.
  18. {
  19.     outb(port, index);
  20.     return(inb(port + 1));
  21. }
  22.  
  23. static inline void IOWriteRegister(
  24.     IOEISAPortAddress port,
  25.     unsigned char index,
  26.     unsigned char value)
  27. // Description:    Write value to register at port and index.
  28. {
  29.     outb(port, index);
  30.     outb(port + 1, value);
  31. }
  32.  
  33. static inline void IOReadModifyWriteRegister(
  34.     IOEISAPortAddress port,
  35.     unsigned char index,
  36.     unsigned char protect,
  37.     unsigned char value)
  38. // Description:    Read-modify-write.
  39. //        Read register at port and index.  Change value while
  40. //        retaining protect bits.
  41. {
  42.     unsigned char val = IOReadRegister(port, index);
  43.     IOWriteRegister(port, index, (val & protect) | value);
  44. }
  45.  
  46.